package com.tuanzi.loan.business.service.family.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tuanzi.loan.business.entity.family.ModuleContentItem;
import com.tuanzi.loan.business.repository.family.ModuleContentItemRepository;
import com.tuanzi.loan.business.service.family.ModuleContentItemService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.vo.view.family.ActivityModelView.ContentItem;

@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class ModuleContentItemServiceImpl implements ModuleContentItemService {

	@Autowired
	private ModuleContentItemRepository moduleContentItemRepository;

	@Override
	public List<ModuleContentItem> findAllByModelId(Long modelId) {
		return moduleContentItemRepository.findAllByModelId(modelId);
	}

	@Override
	public void deleteByModelId(Long modelId) {
		moduleContentItemRepository.deleteByModelId(modelId);
	}

	@Override
	public Integer save(Long modelId, ContentItem contentItem) {
		return moduleContentItemRepository.save(modelId, contentItem);
	}
}
